package com.enseirb.bdxmap.preferences;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class SharedPreferencesManager extends PreferencesManager {
	
	private static final String KEY_DATA_SOURCE_CHOICE	= "data_source_choice";

	public SharedPreferencesManager(Context context) {
		super(context);
	}

	@Override
	public void saveDataSourceChoice(int dataSourceChoice) {
		SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this.context);
		SharedPreferences.Editor editor = preferences.edit();
		editor.putInt(KEY_DATA_SOURCE_CHOICE, dataSourceChoice);
		editor.commit();
	}

	@Override
	public int loadDataSourceChoice() {
		SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this.context);
		return preferences.getInt(KEY_DATA_SOURCE_CHOICE, DEFAULT_DATA_SOURCE_CHOICE);
	}
}
